package com.lagou.task.servlet;

import com.lagou.task.model.Student;
import com.lagou.task.service.StudentService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "ShowServlet", urlPatterns = "/show")
public class ShowServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String sId = request.getParameter("sId");
        StudentService studentService = new StudentService();
        Student student = studentService.studentsSelectById(sId);
        request.getSession().setAttribute("std",student);
        response.sendRedirect("stdMessage.jsp");
    }
}
